package com.itheima.Demo02;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        BBB b = new BBB();
        CCC c = new CCC();
        //获取线程池;
        ExecutorService executor = Executors.newFixedThreadPool(2);
        //接收返回值;
        Future<Integer> f = executor.submit(b);
        Future<String> s = executor.submit(c);
        //返回值调用get方法获取值;
        Integer integer = f.get();
        String s1 = s.get();
        System.out.println(integer);
        System.out.println(s1);

    }
}
